<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Limits the number of elements returned in one batch</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="class.mongocommandcursor.html">« MongoCommandCursor</a></li>
      <li style="float: right;"><a href="mongocommandcursor.construct.html">MongoCommandCursor::__construct »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.mongocommandcursor.html">MongoCommandCursor</a></li>
    <li>Limits the number of elements returned in one batch</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="mongocommandcursor.batchsize" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoCommandCursor::batchSize</h1>
  <p class="verinfo">(PECL mongo &gt;=1.5.0)</p><p class="refpurpose"><span class="refname">MongoCommandCursor::batchSize</span> &mdash; <span class="dc-title">Limits the number of elements returned in one batch</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongocommandcursor.batchsize-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>MongoCommandCursor::batchSize</strong></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$batchSize</code></span>): <span class="type"><a href="class.mongocommandcursor.html" class="type MongoCommandCursor">MongoCommandCursor</a></span></div>

  <p class="para rdfs-comment">
   A cursor typically fetches a batch of result objects and store them
   locally. This method sets the batchSize value to configure the amount of
   documents retrieved from the server in one round trip.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-mongocommandcursor.batchsize-parameters">
  <h3 class="title">Parameters</h3>  
  <p class="para">
   <dl>

    
     <dt>

      <code class="parameter">batchSize</code>
     </dt>

     <dd>

      <p class="para">
       The number of results to return per batch. Each batch requires a
       round-trip to the server. 
      </p>
      <p class="para">
       This cannot override MongoDB&#039;s limit on the amount of data it will return to 
       the client (i.e., if you set batch size to 1,000,000,000, MongoDB will still 
       only return 4-16MB of results per batch). 
      </p>
     </dd>

       
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongocommandcursor.batchsize-returnvalues">
  <h3 class="title">Return Values</h3>  
  <p class="para">
   Returns this cursor.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-mongocommandcursor.batchsize-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-158">
   <p><strong>Example #1 <span class="function"><strong>MongoCommandCursor::batchSize()</strong></span></strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$commandCursor</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">batchSize</span><span style="color: #007700">(</span><span style="color: #0000BB">20</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongocommandcursor.batchsize-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li class="member"><span class="methodname"><a href="mongocursorinterface.batchsize.html" class="methodname" rel="rdfs-seeAlso">MongoCursorInterface::batchSize()</a> - Limits the number of elements returned in one batch</span></li>
  </ul>
 </div>

</div></div></div></body></html>